package com.ytjj.qmyx.supplychain.mapper;

import com.ytjj.qmyx.supplychain.common.model.request.ExceptionOrdersRequest;
import com.ytjj.qmyx.supplychain.common.model.response.ExceptionStatisticsResponse;
import com.ytjj.qmyx.supplychain.mapper.entity.YxExpressOrders;
import com.ytjj.qmyx.supplychain.mapper.entity.YxOrderException;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface OrderExceptionMapper extends Mapper<YxOrderException> {
    /**
     * @Description 查询所有的异常订单
     * @Version 1.0
     **/
    List<YxOrderException> getAllExceptionOrders(ExceptionOrdersRequest exceptionOrdersRequest);

    /**
     * @Description 根据商户ID查询异常订单
     * @Version 1.0
     **/
    List<YxOrderException> getExceptionOrdersByBankerId(ExceptionOrdersRequest exceptionOrdersRequest);

    @Select("select order_on, express_no ,express_code ,express_record from yx_order_exception where order_on = #{orderOn}")
    YxOrderException selectByOrderOn(@Param("orderOn") String orderOn);

    void updatebyExpressMsg(@Param("orderOn") String orderOn,@Param("expressCode")  String expressCode,@Param("expressNo")  String expressNo,@Param("expressRecord") String expressRecord);

    YxOrderException findOrderExceptionByChildOrderNo(@Param("childOrderNo") String childOrderNo);

    List<YxOrderException> findOrderExceptions(@Param("childOrderNoList") List<String> childOrderNoList);

    /**
     * 统计异常订单
     **/
    List<ExceptionStatisticsResponse> getExceptionOrdersStatistics(ExceptionOrdersRequest exceptionOrdersRequest);

    /**
     * 查询需要跟踪的异常订单
     */
    List<YxExpressOrders> getExceptionOrderToTrack(Integer startDay, Date updateTime);


}
